package com.mingqi.enetconnected.primary.personcentre;

import android.view.View;
import android.widget.Toast;

import com.mingqi.enetconnected.R;
import com.mingqi.enetconnected.base.BaseActivity;
import com.mingqi.enetconnected.launch.ChangePasswordActivity;
import com.mingqi.enetconnected.primary.mytask.activity.NotificationMessageActivity;
import com.mingqi.enetconnected.util.resource.ResourceUtils;
import com.mingqi.enetconnected.view.Dialog.CommonDialog;

import butterknife.OnClick;

public class AppSettingActivity extends BaseActivity {

    private CommonDialog mCommonDialog;

    @Override
    protected int getLayoutID() {
        return R.layout.activity_app_setting;
    }

    @Override
    protected void initView() {

        setTitleName(R.string.settings);
    }


    @OnClick({R.id.rl_change_password, R.id.rl_message_notification, R.id.tv_logout})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_change_password:

                startActivity(ChangePasswordActivity.class);
                break;
            case R.id.rl_message_notification:

                startActivity(NotificationMessageActivity.class);
                break;
            case R.id.tv_logout:

                showLogoutDialog();
                break;
        }
    }

    private void showLogoutDialog() {

        if(mCommonDialog == null) {

            mCommonDialog = new CommonDialog(mContext, ResourceUtils.getString(R.string.confirm_logout));
        }
        mCommonDialog.show();
        mCommonDialog.setOnConfirmListener(new CommonDialog.OnConfirmListener() {
            @Override
            public void setOnConfirmClick(CommonDialog instance) {

                Toast.makeText(AppSettingActivity.this, "退出登录", Toast.LENGTH_SHORT).show();
                instance.dismiss();
            }
        });
    }
}
